<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>url截取</title>
</head>
<body>
<input type="button" value="click" class="b1"/>
<script>
    var oBtn=document.querySelector(".b1");
    console.log(window.top.location);
    console.log(window.location.hash);
    console.log(window.location.href);
    console.log(window.location.search);
    console.log(window.location.host);
    console.log(window.location.hostname);
    console.log(window.location.port);
    console.log(window.location.pathname);
    oBtn.onclick=function(){
        window.location.href="promise.html";
    }
</script>
</body>
</html>